tools: ocaml: Handle anonymous struct members of structs in libxl IDL
Julien has a patch "arm: Allow the user to specify the GIC version"
which adds an anonymous struct to libxl_domain_build_info:
@ -480,6 +486,11 @@ libxl_domain_build_info = Struct("domain_build_info",[
])),
("invalid", None),
], keyvar_init_val = "LIBXL_DOMAIN_TYPE_INVALID")),
+
+
+ ("arch_arm", Struct(None, [("gic_version", libxl_gic_version),
+ ])),
+
], dir=DIR_IN
)
(libxl_gic_version is an enum). This is not currently supported by the
ocaml genwrap.py. Add a simple pass which handles simple anonymous
unions as top level members of a struct type, but not more deeply
nested since that would be a much more complex change and is not
currently required.
With Juliens patch applied the relevant resulting change to the .mli
is:
--- tools/ocaml/libs/xl/_libxl_BACKUP_types.mli.in 2015-07-08 11:22:35.
000000000 +0100
+++ tools/ocaml/libs/xl/_libxl_types.mli.in 2015-07-08 12:25:56.
000000000 +0100
@@ -469,6 +477,10 @@ module Domain_build_info : sig
type type__union = Hvm of type_hvm | Pv of type_pv | Invalid
+ type arch_arm__anon = {
+ gic_version : gic_version;
+ }
+
type t =
{
max_vcpus : int;
@@ -510,6 +522,7 @@ module Domain_build_info : sig
ramdisk : string option;
device_tree : string option;
xl_type : type__union;
+ arch_arm : arch_arm__anon;
}
val default : ctx -> ?xl_type:domain_type -> unit -> t
end
The .ml differs similarly. Without Julien's patch there is no change.
gen_struct is refactored slightly to take the indent level as an
argument, since it is now used at a different level.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Julien Grall <julien.grall@citrix.com>
Cc: Dave Scott <Dave.Scott@citrix.com>
Cc: Rob Hoes <Rob.Hoes@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: David Scott <dave.scott@citrix.com>